#ifndef __BACKPIECE_H__
#define __BACKPIECE_H__

#define KNIT_PREARE     (0x00 << 1)
#define KNITING         (0x01 << 1)
#define KNIT_COMPLETE   (0X01 << 2)

/* knit complete,0编织没有开始，１编织中，２编织完成 */
#define LOOP_KC_BIT         (0x03 << 1)
/* side yarn */
#define LOOP_SY_BIT         (0x01 << 3)
/* yarn carrier */
#define LOOP_YC_BIT         (0x01 << 4)
/* need loop bit */
#define LOOP_NL_BIT         (0x01 << 5)
/* is front refused yarn */
#define LOOP_FRY_BIT        (0x01 << 6)
/* is back refused yarn */
#define LOOP_BRY_BIT        (0x01 << 7)
/* 卸片 */
#define LOOP_UNLOAD_BIT     (0x01 << 8)
/* need not manual hd */
#define LOOP_AUTO_HD        (0x01)

#define LOOP_BITS           ((0x01 << 1) | LOOP_SY_BIT | LOOP_YC_BIT)

void backpiece_iterate(MH_KNIT *p);
int backpiece_valid(MH_KNIT *p);
int backpiece_get_start_row(MH_KNIT *p);
int backpiece_get_end_row(MH_KNIT *p);
int backpiece_get_fp_end_row(MH_KNIT *p);
void backpiece_get_first_row_range(MH_KNIT *p, PAT_RANGE *range);
void backpiece_get_pattern_range(MH_KNIT *p, int row, PAT_RANGE *range);
void backpiece_free(MH_KNIT *p);
void backpiece_set_refuseyarn_flag(MH_KNIT *p, int row);
int backpiece_is_refuseyarn(MH_KNIT *p, int row);
void backpiece_save_refuseyarn_range(MH_KNIT *p);
void backpiece_free(MH_KNIT *p);
/*
 *
 */
int GetBackPieceValid(MH_KNIT *p);
/*
 *
 */
void GetAutoHdData(MH_KNIT *p);
/*
 *
 */
ushort GetKnitStartLine(MH_KNIT *p);
/*
 *
 */
ushort GetKnitEndLine(MH_KNIT *p);


#endif /* __BACKPIECE_H__ */

